import request from '@/utils/request'

// 登陆
export function login(data) {
  let username = data.username;
  let password = data.password
  console.log('username', username)
  console.log('password', password)
  return request({
    url: '/admin/users/login',
    method: 'post',
    params: {
      username,
      password
    }
  })
}

// 分页列表查询
export function userList(pageNo, pageSize, search) {
  return request({
    url: '/admin/users/PageInfo',
    method: 'get',
    params: {
      pageNo,
      pageSize,
      search
    }
  })
}

// 单个查询
export function updateUserFlagById(id) {
  return request({
    url: '/admin/users/queryById',
    method: 'get',
    params: {
      id
    }
  })
}

// 删除
export function deleteUser(id) {
  return request({
    url: `/admin/users/delete`,
    method: 'delete',
    params: {
      id
    }
  });
}

// 添加方法
export function add(data) {

  return request({
    url: '/admin/users/add',
    method: 'post',
    data
  })
}
// 添加方法
export function update2(data) {

  return request({
    url: '/admin/users/update',
    method: 'post',
    data
  })
}

export function update3(data) {

  return request({
    url: '/admin/users/updateByRole',
    method: 'post',
    data
  })
}


export function logout() {
  return request({
    url: '/admin/loginOut',
    method: 'get'
  })
}
